import { Injectable } from '@nestjs/common';
import { CreateUserDto } from './dto/create-user.dto';
import { UpdateUserDto } from './dto/update-user.dto';
import { User } from './entities/user.entity'
import { InjectRepository } from '@nestjs/typeorm'
import { Repository } from 'typeorm'

@Injectable()
export class UserService {
  constructor(@InjectRepository(User) private readonly user:Repository<User>){}
  create(createUserDto:CreateUserDto) {
    console.log(createUserDto)
    return this.user.save(createUserDto)
  }

  findOne(username:string){
    return this.user.findOne({
      where:{
        username
      }
    })
  }
}
